<!--
 * @Author: 秦少卫
 * @Date: 2024-04-25 15:30:54
 * @LastEditors: 秦少卫
 * @LastEditTime: 2024-05-30 11:53:28
 * @Description: 我的素材
-->

<template>
  <div class="my-material" v-if="isLogin">
    <el-tabs v-model="type">
      <el-tab-pane label="模板" name="templ">
        <myTempl v-if="type === 'templ'"></myTempl>
      </el-tab-pane>
      <el-tab-pane label="图片" name="img">
        <uploadMaterial v-if="type === 'img'"></uploadMaterial>
      </el-tab-pane>
    </el-tabs>
  </div>
  <div class="tip" v-else>请先登录</div>
</template>

<script setup name="ImportTmpl">
import { getFileList } from '@/api/user'
import uploadMaterial from './uploadMaterial.vue'
import myTempl from './myTempl.vue'

const type = ref('templ')
const isLogin = ref(false)
const getFileListHandle = () => {
  // 获取素材列表
  getFileList()
    .then(() => {
      isLogin.value = true
    })
    .catch(() => {
      isLogin.value = false
    })
}

getFileListHandle()
</script>

<style scoped lang="scss">
.tip {
  padding: 20px;
  text-align: center;
}
</style>
